//
//  MCBillingInfoCell.swift
//  StoreManage
//
//  Created by MC on 2018/8/10.
//  Copyright © 2018年 MC. All rights reserved.
//

import UIKit


class MCBillingInfoCell: UITableViewCell {
    

    var model = MCBillingInfoModel() {
        didSet {
            titleLabel.text = "订单编号:" + model.orderSn
            timeLabel.text = model.createTime
            moneyLabel.text = MCString_judgemantDecimalsIsZero(figure: model.money.intValue)
        }
    }
    
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        initUI()
    }
    
    func initUI() {
        
        self.addSubview(bgView)
        bgView.snp.remakeConstraints { (make) -> Void in
            make.edges.equalTo(self).inset(UIEdgeInsetsMake(0, 0, 1, 0))
        }
        
        bgView.addSubview(titleLabel)
        titleLabel.snp.remakeConstraints { (make) -> Void in
            make.left.equalTo(bgView).offset(15)
            make.bottom.equalTo(bgView.snp.centerY)
        }
        
        bgView.addSubview(timeLabel)
        timeLabel.snp.remakeConstraints { (make) -> Void in
            make.left.equalTo(titleLabel)
            make.top.equalTo(bgView.snp.centerY).offset(6)
        }
        
        bgView.addSubview(moneyLabel)
        moneyLabel.snp.remakeConstraints { (make) -> Void in
            make.right.equalTo(bgView).offset(-15)
            make.centerY.equalTo(bgView)
        }
    }
    
    lazy private var bgView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.white
        return view
    }()
    
    lazy private var titleLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(15)
        label.textColor = UIColor.MCWords
        label.text = "订单编号"
        return label
    }()
    
    
    lazy private var timeLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(12)
        label.textColor = UIColor.MCGray_middle
        return label
    }()
    
    lazy private var moneyLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(20)
        label.textColor = UIColor.MCBlack
        return label
    }()
}
